/**
 * Created by hiibook on 2017/6/15.
 */

module.exports=function (wechatMsg,Object) {
    console.log('构建消息');
    switch (Object.Type){
        case "text" :
            // 回复文本消息
            return textConstruct(wechatMsg,Object);
            break;
        case "image" :
            // 回复图片消息
            return imageConstruct(wechatMsg,Object);
            break;
        case "voice" :
            //回复语音消息
            return voiceConstruct(wechatMsg,Object);
            break;
        case "video" :
            //回复视频消息
            return videoConstruct(wechatMsg,Object);
            break;
        case "music" :
            // 回复音乐消息
            return musicConstruct(wechatMsg,Object);
            break;
        case "news" :
            // 回复图文消息
            return newsConstruct(wechatMsg,Object);
            break;
        default :
            break;
    };
    function textConstruct(wechatMsg,Object) {
            var chat ="<xml>"+
                "<ToUserName><![CDATA["+wechatMsg.FromUserName+"]]></ToUserName>"+
                "<FromUserName><![CDATA["+wechatMsg.ToUserName+"]]></FromUserName>"+
                "<CreateTime>"+wechatMsg.CreateTime+"</CreateTime>"+
                "<MsgType><![CDATA[text]]></MsgType>"+
                "<Content><![CDATA["+Object.Content+"]]></Content>"+
                "</xml>";
        return chat;
    }
    function imageConstruct(Object) {

    }
    function voiceConstruct(Object) {

    }
    function videoConstruct(Object) {

    }
    function musicConstruct(Object) {

    }
    function newsConstruct(Object) {

    }

}